const { dateFormat, accessLog } = require('../utils/index')
module.exports = function AccessLog(req, res, next) {
  if (!req.url.startsWith('/favicon')) {
    const dt = dateFormat(new Date(), true)
    console.log('[Access] ', dt, req.url, req.body)
    accessLog(`${dt} ${req.url} ${JSON.stringify(req.body || {})}`)
  }
  next()
}